package com.mycompany.chatapp;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.jivesoftware.smack.XMPPException;
/**
 * Main de testeo de la aplicacion sin interfaz grafica 
 * @author Group C
 *
 */
public class App 
{
    public static void main( String[] args ) throws IOException, XMPPException
    { 
        //Usado en el TRANSMISOR
        String user="usuariopruebagrupoc";
        System.out.println("You are connected as: "+user);
        String pass="1234grupoc";
        
        /*
        //Usado en el RECEPTOR
        String user="carloscardona01@gmail.com";
        System.out.println("You are connected like: "+user);
        //Poner propio password!!
        String pass="********************";
        */
        
        //Create the ImpInstantMessage object
        ImpInstantMessage instantMessage=ImpInstantMessage.getIntanceMessage();
        //Login of the user
        instantMessage.login(user,pass);
        //Add contents to the local HashMap
        instantMessage.addHash();
        //Show a list of contacts
        System.out.println("**************CONTACT LIST***********************");
        instantMessage.displayContactList();
        
        //Imprimimos que usuario somos
        System.out.println(System.getProperty("user.home"));
        String userID=instantMessage.getXMPPConnection().getUser(); //paso mi direccion completa
        System.out.println("FULL IDuser: "+userID);
        String genericPath= System.getProperty("user.home");
        
        System.out.println("Introduce the Photo that you wish: ");
        BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
        String namePhoto = br.readLine();
        
        //PARA EJECUTAR EN EL Rx, COMENTAR ESTA LINEA, no es necesaria!!
        instantMessage.sendMessageUserContent(userID, user, genericPath+"\\Rx\\"+namePhoto, "carloscardona01@gmail.com");
        System.out.println(genericPath+"\\Rx\\"+namePhoto);
        
        //EXIT of chatapp
        System.out.println("Press ENTER to LOGOUT");
        System.in.read();
        instantMessage.logout();
        System.out.println(userID+" EXIT!!");
        System.exit(0);
     }
}
